import { Tabs } from "antd"
import AttributeCP from "./attributeCP"
import { useEffect, useState } from "react"
import { useSearchParams } from "react-router-dom"
import { getDBListDetail as getDBListDetailApi } from '@/api/root'

const Detailpage: React.FC = () => {
    const [search] = useSearchParams()
    const [detailData, setdetailData] = useState<GetDBListDetail.Response>({ uId: '' })
    useEffect(() => {
        if (search.has('uId')) {
            const uId = search.get('uId')
            getDBListDetail(uId!)
        }
    }, [])
    // 获取详情
    const getDBListDetail = async (uId: string) => {
        const res = await getDBListDetailApi({ uId })
        if (res.code !== 1) return
        setdetailData(res.data)
    }
    return (<>
        <div>
            <Tabs defaultActiveKey="1" items={[
                { label: '属性', key: '1', children: <AttributeCP detailData={detailData}></AttributeCP> }, // 务必填写 key
                { label: '接口', key: '2', children: '内容 2' },
            ]}>
            </Tabs>
        </div>
    </>)
}
export default Detailpage